package com.ganzalang.gmall.designpatterns.singleton.lazyload;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;

/**
 * @description: 给方法加锁
 * @author: ganzalang
 */
@Slf4j
public class SynchronizedMethodLazyLoadSingleton {

    private static SynchronizedMethodLazyLoadSingleton singleton;

    private SynchronizedMethodLazyLoadSingleton() {

    }

    public static synchronized SynchronizedMethodLazyLoadSingleton getInstance() {
        if (singleton == null) {
            singleton = new SynchronizedMethodLazyLoadSingleton();
        }
        return singleton;
    }
}
